package org.evs.odesk.programmingSkills;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 * @author Walter 
	Write a program which will print the below structures according to the input provided to the program. The program should accept 3 inputs in the form of numbers between 1 and 9, both inclusive (one number per line) and then generate the corresponding structures based on the input.
	
	Suppose the following sequence of numbers is supplied to the program:
	
	3
	2
	4
	
	Then the output should be:
	  1
	 2 2
	3 3 3
	 1
	2 2
	   1
	  2 2
	 3 3 3
	4 4 4 4
	
	
	IMPORTANT NOTES - READ CAREFULLY:
	
	1. In case of input data being supplied to the question, it should be assumed to be a console input
	
	2. Your solution should contain class name as Main, as the solution will be compiled as Main.java

 */
public class Task_PiramidFormating {

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));

        int n1 = Integer.parseInt(bufferRead.readLine());
        int n2 = Integer.parseInt(bufferRead.readLine());
        int n3 = Integer.parseInt(bufferRead.readLine());

        printLine(n1);
        printLine(n2);
        printLine(n3);

    }

    public static String printLine(int num) {
        String tmp = "";
        ArrayList<String> list = new ArrayList<String>();
        for (int i = num; i > 0; i--) {
            for (int j = 0; j < i; j++)
                tmp = tmp + i + " ";
            list.add(tmp);
            tmp = "";
        }

        int shift = num - 1;
        for (int i = list.size() - 1; i >= 0; i--) {
            System.out.println(getSpacedString(shift) + list.get(i));
            shift--;
        }

        return tmp;

    }

    public static String getSpacedString(int num) {
        if (num < 0) {
            return "";
        }
        return "                                                                             ".substring(0, num);
    }
}
